<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cmcc.resource.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<% 
	
	
%>
<% 
	int wide = 12;
	String strPageNo = request.getParameter("pageNo");
	int pageNo=1;
	if(strPageNo!=null && !strPageNo.equals("")){
		pageNo = Integer.parseInt(strPageNo);		
	}	
	
	int count = Resource.getCount();
	int allPage = count%wide==0 ? count/wide : count/wide+1;	
	if(pageNo<1){
		pageNo=allPage;
	}
	if(pageNo>allPage){
		pageNo=1;
	}
	
	System.out.println("共 "+allPage+" 页  ------- 第 "+pageNo+" 页");
	int start = (pageNo-1) *12;
	HashSet<String> nums = Resource.getAvailableNnmber(start,wide);
	//ArrayList<Operator> list = Operator.getList(start, wide);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    
    <title>My JSP 'addMoble.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    
    
    
    
    
    <div>
    	<table>
    		<% 
    			for(Iterator<String> i = nums.iterator(); i.hasNext();){
    				String num1 = "";
    				String num2 = "";
    				String num3 = "";
    				num1 = i.next();
    				if(i.hasNext()){
    					num2 = i.next();	
    				}
    				if(i.hasNext()){
    					num3 = i.next();	
    				}	

    		%>
    		<tr>
    			<td><%=num1 %></td>
    			<td><%=num2 %></td>
    			<td><%=num3 %></td>
    		</tr>
    		
    		<% 
    			}
    		%>
    		
    	</table>
    </div>
    <br><br><br>
    <a href=" AvaliableMobile.jsp?pageNo=<%=pageNo-1%>">上一批</a>
	&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
	<a href=" AvaliableMobile.jsp?pageNo=<%=pageNo+1%>">下一批</a>
  </body>
</html>
